#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from models.objectId import objectId
import hashlib
import time
class domain(objectId):
    def __init__(self):
        super(domain,self).__init__()
        self.model["name"]=None
        self.model["lastgettime"]=None
        self.model["hashMD5"]=None
        self.model["rule"]=None
        self.model["local"]=None #0,1 defalut:0,  0 不限定，1限定

    @property
    def domainName(self):
        return self.model["name"]
    @domainName.setter
    def domainName(self,args):
        self.model["name"]=args

    @property
    def lastGetTime(self):
        return self.model["lastgettime"]
    @lastGetTime.setter
    def lastGetTime(self,args):
        self.model["lastgettime"]=args

    @property
    def hashMD5(self):
        return self.model["hashMD5"]
    @hashMD5.setter
    def hashMD5(self,args):
        if args:
            self.model["hashMD5"]=hashlib.md5(args.encode("utf-8")).hexdigest()
        else:
            self.model["hashMD5"]=None

    @property
    def rule(self):
        return self.model["rule"]

    @rule.setter
    def rule(self,args):
        if args:
            self.model["rule"]=args
        else:
            self.model["rule"]=None

    @property
    def local(self):
        return self.model["local"]

    @local.setter
    def local(self,args):
        if args:
            self.model["local"]=args
        else:
            self.model["local"]=0